#ifndef PRIMITIVE_H
#define PRIMITIVE_H

#include "aabb.h"
#include "ray.h"
#include "vector3.h"

class Primitive
{
public:

	// Must return smallest aabb enclosing whole primitive
	virtual AABB getAABB() = 0;

	// Calculates closest intersection between ray and primitive
	virtual bool intersect(const Ray& ray, 
			Vector3& point, Vector3& normal) = 0;

	// Same as intersect, bool result only
	virtual bool intersectShadow(const Ray& ray);
};

class Sphere : public Primitive
{
public:
	Sphere(const Vector3& center, float radius)
		: center(center), radius(radius) {}

	virtual AABB getAABB();

	virtual bool intersect(const Ray& ray, 
			Vector3& point, Vector3& normal);

private:	
	Vector3 center;
	float radius;
};

#endif
